from file_toolkit import read_dict_from_file
from file_toolkit import write_dict_to_file

severe_activity_file = 'severe_activity_level.txt'
rest_activity_file = 'rest_activity_level.txt'



comparsion_uid = {}

comparsion_uid_file = 'comparsion_uid_pair.txt'

severe_activity_dict = read_dict_from_file(severe_activity_file)
rest_activity_dict = read_dict_from_file(rest_activity_file)

count = 0

for severe_key, severe_value in severe_activity_dict.items():
    count += 1
    print(count)
    difference = 100000
    for rest_key, rest_value in rest_activity_dict.items():
        temp = abs(float(severe_value)-float(rest_value))
        if temp < difference:
            difference = temp
            comparsion_uid[severe_key] = rest_key

write_dict_to_file(comparsion_uid_file,comparsion_uid)